extends Label

@onready var area_2d: Area2D = $Area2D

func _ready() -> void:
	visible = false
	area_2d.body_entered.connect(on_body_entered.unbind(1))

func on_body_entered() -> void:
	area_2d.queue_free()
	visible = true
	var tween = create_tween()
	tween.set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_CUBIC)
	tween.set_parallel()
	tween.tween_property(self,"modulate:a",1,2).from(0)
	tween.tween_property(self,"global_position:y",global_position.y-100,3.0).from(global_position.y+50)
	tween.tween_property(self,"scale", Vector2.ONE,0.5).from(Vector2.ZERO)
	tween.tween_property(self,"modulate:a",0,1.0).from(1)
	tween.chain().tween_callback(queue_free)
	
